package com.anxinr.controller.user;

import com.anxinr.pojo.dto.UserDTO;
import com.anxinr.pojo.entity.User;
import com.anxinr.result.Result;
import com.anxinr.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * 用户模块
 *
 * @author anxinr
 */
@Slf4j
@RestController
@RequestMapping("/user")
@Api("用户模块")
public class UserController {
    @Autowired
    private UserService userService ;
    /**
     * 用户登录
     * @author anxinr
     * @return HashMap
     */
    @ApiOperation("用户登录")
    @PostMapping("/login")
    public Result<HashMap<String,Object>> login(@RequestBody UserDTO user){
        return new Result(userService.login(user));
    }
}
